package com.cjj.controller;

import com.cjj.service.TemplateManagementService;
import com.cjj.vo.InterveneVo;
import com.github.pagehelper.PageInfo;
import com.guigu.pojo.TInterveneModel;
import com.guigu.viwe.PageVo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/templateManagement")
public class TemplateManagementController {
    @Resource
    private TemplateManagementService templateManagementService;

    //分页查询
    @RequestMapping("/queryTemplateManagement")
    public PageInfo<TInterveneModel> queryTemplateManagement(@RequestBody PageVo<TInterveneModel> pageVo) {
        return this.templateManagementService.queryTemplateManagement(pageVo);
    }

    // 查询饮食运动干预
    @RequestMapping("/queryIntervene")
    public InterveneVo queryIntervene() {
        return this.templateManagementService.queryIntervene();
    }

    //添加模板
    @RequestMapping("/addOnSubmit")
    public int addOnSubmit(@RequestBody TInterveneModel tInterveneModel) {

        return this.templateManagementService.addOnSubmit(tInterveneModel);
    }

    //禁用启用
    @RequestMapping("/DisableEnable")
    public int DisableEnable(@RequestBody Map map){
        return this.templateManagementService.DisableEnable(map);
    }

    //修改模板
    @RequestMapping("/updateTemplat")
    public int updateTemplat(@RequestBody TInterveneModel tInterveneModel){
        return this.templateManagementService.updateTemplat(tInterveneModel);
    }
}
